
<%
    HttpSession s = request.getSession();
%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- 模态框（Modal） -->
<div class="modal fade" id="addModel" data-backdrop="static"
     tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div id="addAlert">
    </div>
    <div class="modal-dialog" style="width: 60%; ">
        <!--  这下面放一个隐藏的input框-->
        <input type="hidden" id="submitType" value="POST">
        <div class="modal-content" style="background: #F5F5F5;">
            <div class="modal-header">
                <button type="button" class="close" id="addAlertSubmit"
                        data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">新增文件类型</h4>
            </div>
            <!-- <form class="form-inline horizontal " role="form"> -->
            <form class="form-horizontal" role="form" id="trainForm" >
                <div class="modal-body" style="height: 60%;">
                    <div class="col-lg-10 col-md-9 col-sm-9 ">
                        <!-- <div class="row"> -->
                        <div class="form-group " >
                            <%--@declare id="name"--%><label for="name" class=" col-lg-2 control-label" style=" padding-top: 30px;">员工账号</label>
                            <div class=" col-lg-4 " style=" padding-top: 25px;">
                                <input type="hidden" name="id" id="id" value="">
                                <input type="text" class=" form-control  " name="userAcount"
                                       id="userAcount" placeholder="请输入员工账号">
                            </div>
                            <label for="name" class=" col-lg-2 control-label" style=" padding-top: 30px;">公积金金额</label>
                            <div class=" col-lg-4 " style=" padding-top: 25px;">
                                <input type="text" class=" form-control  " name="money"
                                       id="money" placeholder="请输入公积金金额">
                            </div>
                            <label for="name" class=" col-lg-2 control-label" style=" padding-top: 30px;">保险金额</label>
                            <div class=" col-lg-4 " style=" padding-top: 25px;">
                                <input type="text" class=" form-control  " name="insurance"
                                       id="insurance" placeholder="请输入保险金额">
                            </div>
                            <label for="name" class=" col-lg-2 control-label" style=" padding-top: 30px;">公积金账户</label>
                            <div class=" col-lg-4 " style=" padding-top: 25px;">
                                <input type="text" class=" form-control  " name="acount"
                                       id="acount" placeholder="公积金账户">
                            </div>
                            <label for="name" class=" col-lg-2 control-label" style=" padding-top: 30px;">缴纳月份</label>
                            <div class=" col-lg-4 " style=" padding-top: 25px;">
                                <input type="text" class=" form-control  " name="date"
                                       id="date" placeholder="请输入缴纳月份">
                            </div>
                        </div>
                        <!-- 	</div> -->
                    </div>
                </div>
                <div class="modal-footer">
                    <!-- 	<button type="button" class="btn btn-info btn-sm " id=addSubmit
                            data-dismiss="modal" style="margin-left: 15px; margin-right: 5%;">
                            <span class="glyphicon glyphicon-user"></span> 新增员工
                        </button> -->
                    <button type="submit" class="btn btn-info btn-sm " id="addSubmit"
                            name="submit"  style="margin-left: 15px; margin-right: 5%;">
                        <span class="glyphicon glyphicon-user"></span> 确定
                    </button>
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
</div>
<%-- <script
    src="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/js/jquery-min.js"></script>
<script
    src="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/js/bootstrap.min.js"></script> --%>
<script type="text/javascript">



    $(function() {
        $('#trainForm').bootstrapValidator({
            message : 'This value is not valid',
            feedbackIcons : {
                valid : 'glyphicon glyphicon-ok',
                invalid : 'glyphicon glyphicon-remove',
                validating : 'glyphicon glyphicon-refresh'
            }
        }).on(
            'success.form.bv',
            function(e) {//点击提交之后
                // Prevent form submission
                e.preventDefault();
                // Get the form instance
                var $form = $(e.target);
                // Get the BootstrapValidator instance
                var bv = $form.data('bootstrapValidator');
                // Use Ajax to submit form data 提交至form标签中的action，result自定义
                var train = getFormData($("#trainForm"));
                $.ajax({
                    type : $("#submitType").val(),  //请求方式
                    url : "${pageContext.request.contextPath}/addAccumulationFund",  //请求路径
                    data: train,
                    async: true,
                    dataType:"json",
                    //contentType:"application/json;charset=utf-8",
                    success : function(msg) {  //异步请求成功执行的回调函数
                        $( "#addAlert" ).load( "WEB-ROOT/common/alert.jsp", function( response, status, xhr ) {
                            $('#addAlert').html(response);
                            $("#alertText").text(msg.message);
                            $("#alertModel").modal({
                                keyboard: true
                            });
                        });
                        //  selectList("true");
                    },//ajax引擎一般用不到；状态信息；抛出的异常信息
                    error : function(msg) {
                        //alert("失败");
                        $( "#addAlert" ).load( "WEB-ROOT/common/alert.jsp", function( response, status, xhr ) {
                            $('#addAlert').html(response);
                            $("#alertText").text("操作失败");
                            $("#alertModel").modal({
                                keyboard: true
                            });
                        });
                    }
                });
            });
    });
</script>
</body>